requests get image from url

38

requests get image from url -

import requests
import io
from PIL import Image

response = requests.get("https://i.imgur.com/ExdKOOz.png")
image_bytes = io.BytesIO(response.content)

img = Image.open(image_bytes)
print(f'Size: {img.size}')
img.show()

Comments

Submit
1 Comments
  • 22/1/2024 0:30 - Europe/Istanbul

response = requests.get("https://i.imgur.com/8zjJQ5f.jpg")
img = Image.open(BytesIO(response.content))
img.show()